package com.imot.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.imot.pojo.dto.FaultTestDto;
import com.imot.pojo.entity.EmaExceptionRecord;
import com.imot.response.Result;
import com.imot.service.EmaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: LimitCheckController
 * Description:
 * date: 2023/11/12 18:40
 *
 * @author imot-jiah.wang
 */
@Api(tags = "阈值判断控制器")
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/limitCheck")
public class LimitCheckController {

    private final EmaService emaService;

    @GetMapping("/getStatusCheck")
    @ApiOperation("获取工况情况")
    public Result getStatusCheck(){
        Result result = emaService.statusCheck();
        return result;
    }

    @GetMapping("/getRunMonitoring")
    @ApiOperation("获取运行监控")
    public Result getRunMonitoring(){
        Result result = emaService.runMonitoring();
        return result;
    }

    @GetMapping("/getMonitorWave")
    @ApiOperation("获取监测波形图")
    public Result monitorWave(String name){
        Result result = emaService.monitorWave(name);
        return result;
    }

    @ApiOperation("异常描述")
    @GetMapping("/getDescribeFault")
    public Result getDescribeFault(){
        Result result = emaService.getDescribeFault();
        return result;
    }

    @PostMapping("/getExceptionMonitor")
    @ApiOperation("异常监测")
    public Result getFaultTest(@RequestBody FaultTestDto faultTestDto){
        Result result = emaService.getFaultTest(faultTestDto);
        return result;
    }

    @DeleteMapping("/deleteExceptionData")
    @ApiOperation("删除异常监测信息")
    public Result deleteFaultTest(Integer id){
        Result result = emaService.deleteFaultTest(id);
        return result;
    }

    @PutMapping("/updateExceptionData")
    @ApiOperation("修改异常确认信息")
    public Result updateFaultTest(Integer id,String faultRight){
        Result result = emaService.updateFaultTest(id,faultRight);
        return result;
    }

    @ApiOperation("获取异常信息详情")
    @GetMapping("/getExceptionDetail")
    public Result getExceptionDetail(Integer id){
        Result result = emaService.getExceptionDetail(id);
        return result;
    }

//------------------------------------------------------------------------

    @ApiOperation("获取历史异常数据")
    @PostMapping("/getHistoryExceptionData")
    public Result getHistoryData(@RequestBody FaultTestDto faultTestDto){
        Result result = emaService.getHistoryData(faultTestDto);
        return result;
    }

    @ApiModelProperty("获取历史异常数据的异常确认")
    @GetMapping("/getHistoryExceptionConfirmation")
    public Result getHistoryExceptionConfirmation(Integer emaExceptionId){
        Result result = emaService.getHistoryExceptionConfirmation(emaExceptionId);
        return result;
    }

    @ApiOperation("获取历史异常数据状态")
    @GetMapping("/getExceptionHistoryData")
    public Result getFaultData(){
        Result result = emaService.getFaultHistoryStatus();
        return result;
    }


    @ApiOperation("修改历史异常数据")
    @PutMapping("/updateExceptionHistoryData")
    public Result updateExceptionHistoryData(@RequestBody EmaExceptionRecord emaExceptionRecord){
        Result result = emaService.updateExceptionHistoryData(emaExceptionRecord);
        return result;
    }

}

